//
//  ShopTrolley.m
//  XDLookPic
//
//  Created by wanglong8889@126.com on 14-5-21.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "ShopTrolley.h"
#import "XDTools.h"
@implementation ShopTrolley

//"goods_id" = 1;
//"goods_name" = "\U6cd5\U56fd\U7687\U5bb6\U72d7\U7cae\U8d35\U5bbe\U72ac\U6210\U72ac \U6cf0\U8fea\U4e13\U7528\U7cae3kg\U6c5f\U6d59\U6caa\U7696\U5305\U90ae\U7687\U51a0\U72d7\U7caebj";
//"goods_number" = 1;
//"goods_price" = "154.00";
//"goods_thumb" = "http://ts.leepet.com/images/201405/thumb_img/1_thumb_G_1400547132527.jpg";
//"goods_weight" = "1.500";
//"order_id" = 106;

-(id)initWithDic:(NSDictionary *)dic{
    self = [super init];
    if (self) {
        self.imageUrl = [dic objectForKey:@"goods_thumb"];
        self.content = [dic objectForKey:@"goods_name"];
        self.state = @"现货";
        self.number = [dic objectForKey:@"goods_number"];
        self.price = [dic objectForKey:@"goods_price"];
        self.goodId = [dic objectForKey:@"goods_id"];
        self.shopId = [dic objectForKey:@"rec_id"];
        self.weight = [dic objectForKey:@"goods_weight"];
        self.goodsAttr = [dic objectForKey:@"goods_attr"];
        
        [XDTools judgeIsNull:self.imageUrl];
        [XDTools judgeIsNull:self.content];
        [XDTools judgeIsNull:self.weight];
        [XDTools judgeIsNull:self.number];
        [XDTools judgeIsNull:self.price];
        [XDTools judgeIsNull:self.goodsAttr];
        if (!IS_NOT_EMPTY(self.goodsAttr)) {
            self.attrHeight = 0.0;
        }else{
            CGRect r = [XDTools autoSizeOftext:self.goodsAttr andSize:CGSizeMake(170, 1000) andtextFont:12.0];
            self.attrHeight = r.size.height;
        }
       
    }
    return self;
}
@end
